{% extends "admin_form_base.jinja" %}
{% import 'macros.jinja' as macros %}

{%- block header_title -%}
Application Status - Review for {{ submission.get_full_name() }}
{%- endblock header_title -%}

{#
  Within the scope of this form, status_update is an unsaved
  StatusUpdate instance.
#}

{% block form %}
<form id="review-status-form" method="POST" action="{{ url('intake-review_status_notification', submission_id=submission.id ) }}">
  {% include "includes/csrf_field.jinja" %}
  <ul>
    <li>
      <em>Status:</em>
      {{ status_update.status_type.display_name }}
    </li>
    <li>
      <em>Additional info:</em>
      {% if status_update.additional_information %}
      {{ status_update.additional_information }}
      {% else %}
      —
      {% endif %}
    </li>
    <li>
      <em>Next steps:</em>
      <ul>
        {% for step in status_update.next_steps.all() %}
          <li>{{ step.display_name }}</li>
        {% endfor %}
        {% if status_update.other_next_step %}
          <li>{{ status_update.other_next_step }}</li>
        {% endif %}
      </ul>
    </li>

  </ul>

<div class="field sent_message{% if warning %} warnings{% endif %}">
    {%- if warning %}
    <ul class="warninglist">
      <li class="warning">
      {{ warning }}
      {%- if contact_info %}
      But if you'd like to contact them outside of Clear My Record, here is their contact info:
      {{ all_contact_info_display_form }}
      {%- endif %}
      </li>
    </ul>
    {%- endif %}
    <label class="field-wrapping_label">
      {%- if usable_contact_info %}
      <span class="field-display_text">
        The following message will be {{ contact_method_verbs(usable_contact_info.keys()) }} to the applicant:
      </span>
      {%- else %}
      <span class="field-display_text">
        Example message
      </span>
      {%- endif %}
    </label>
    <span class="field-preceding_text">
      {{ intro_message }}:
    </span>
    <span class="field-input_wrapper">
      <textarea name="sent_message">{{ form.sent_message.value() }}</textarea>
    </span>
</div>
  <p>
    <a 
      class="btn btn-lg btn-default"
      href="{{ url('intake-create_status_update', submission_id=submission.id) }}">Back</a>
    {%- if usable_contact_info %}
    <input type="submit" value="Send message" class="btn btn-lg btn-primary">  
    {%- else %}
    <input type="submit" value="Save status" class="btn btn-lg btn-primary"> 
    {%- endif %}
  </p>
</form> 
{% endblock form %}